<template>
	<om-formsub-outer :index="index" :checkedit="checkedit">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '../../../static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData({
				userCacheKey:"fin-jj-pieceRateWageStatistics-title2-user-cache"
			})
		},
		methods:{
			
		},
		onShow() {
		let _that = this
		if(_that.$refs.autoform){
			uni.getStorage({
				key:_that.userCacheKey,
				success:(res)=>{
					if(res.data){
						let d = res.data
						let formdata = _that.$refs.autoform.formdata
						formdata.userPostId = d.id
						formdata.userId = d.userId
						formdata.userName = d.userName
						formdata.postName = d.posName
						formdata.postId = d.posId
						uni.removeStorage({
							key:_that.userCacheKey
						})
					}
				}
			})
		}
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
			if(e.configDataCacheKey){
				uni.getStorage({
					key: e.configDataCacheKey,
					success: function(res) {
						if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
							_that.autoformdata = res.data
							Object.assign(_that.initValue, _that.formdata)
							_that.autoformdata[0].order = _that.order
								changeEditor("title2","userPostId",{
									link:"../../public/pageSearch/pageSearch",
									"linkParam":{
										other:JSON.stringify({
											firstUserId: _that.userId
										}),
										initLoad:false,
										url:"orgInstPosUserOfficial/findListByOrg",
										namefield:"userPosName",
										cachename:_that.userCacheKey,
										searchfield:"q",
										placeholder:"请输入姓名或岗位"
									}
								},null,_that.autoformdata)
							}
						}
					})
				}
							
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                  
